    Patent document 1: JP-H6-110793 A    Patent document 2: JP-2000-11670 A
High integration of flash memories, which are a kind of an electrically rewritable nonvolatile memory, is in progress in recent years. The flash memories are used as secondary storage devices or media such as memory cards, USB memories, and HDDs. Particularly, the memory cards are widely used as storage media of electronic devices, such as digital cameras and mobile phones. Some memory cards have storage capacity of several gigabytes.
However, the flash memories used for many applications have limited data retention periods (data retention problem). In NAND flash memories, which are suitable for larger capacity in comparison with, e.g., NOR flash memories, when data is read from a cell, data stored in the other memory cells sharing the same lead with the memory cell is gradually destroyed (read disturb problem, also called read retention problem).
For addressing such a problem, in general, the data area for ECC (Error Check and Correction) is provided, and the abnormalities of the data read from the flash memory are detected and corrected.
Patent document 1 discloses, as a countermeasure against the read disturb problem, the invention about a nonvolatile semiconductor storage device for counting the number of reads of data from blocks constituting a flash memory and for rewriting data in a block in which the number of reads of data reaches a predetermined number. The block is a unit constituting the area storing data in a flash memory, and is a minimum unit in which data can be deleted independently.
Patent document 2 discloses, as a countermeasure against the data retention problem, the invention about a device having a refresh circuit for measuring an elapsed time after writing data into a flash memory, and for rewriting data into the flash memory after a predetermined elapsed time.
However, the rewrite is interrupted when supply of the electric power to the devices of Patent documents 1 and 2 is stopped during the rewrite of the data into the flash memory. When the supply of the electric power is stopped, the data of the block to be rewritten may be destroyed. As mentioned above, the storage capacity of the flash memories is increasing, and the time required for the rewrite into the flash memory also is increasing, so that it is likely that the rewrite is interrupted. Some countermeasure against the above disadvantages is necessary.